import request from '@/utils/request'

// 所有商品列表
export function fetchProduct(data) {
  return request({
    url: '/product/list',
    method: 'get',
    params: data
  })
}

// 标签列表
export function fetchProductTypeList(data) {
  return request({
    url: '/product/type/list',
    method: 'get',
    params: data
  })
}

// 创建标签
export function addProductType(data) {
  return request({
    url: '/product/type/add',
    method: 'post',
    params: data
  })
}

// 删除标签
export function removeProductType(data) {
  return request({
    url: '/product/type/remove',
    method: 'post',
    params: data
  })
}

// 获取商家的商品列表
export function fetchMerchantProduct(data) {
  return request({
    url: '/product/merchantList',
    method: 'get',
    params: data
  })
}

export function updateProduct(data) {
  return request({
    url: '/product/edit',
    method: 'post',
    params: data
  })
}

export function createProduct(data) {
  return request({
    url: '/product/add',
    method: 'post',
    params: data
  })
}

export function deleteProduct(params) {
  return request({
    url: '/product/delete',
    method: 'post',
    params
  })
}

export function findProudct(params) {
  return request({
    url: '/product/detail',
    method: 'get',
    params
  })
}
